<template>
    Home
    <button @click="pushStr">字符串跳转</button>
    <button @click="pushPath">路径跳转</button>
    <button @click="pushName">push-名字-跳转</button>
    <button @click="pushNameParams">push-名字-跳转-传递参数</button>
    <button @click="pushPathQuery">push-路径-跳转-传递参数</button>




</template>

<script setup>
import { useRoute, useRouter } from 'vue-router';


const route = useRoute()
const router = useRouter()

console.log('route', route);
console.log('router', router);

const pushStr = ()=>{
    router.push('/about')
}
const pushPath = ()=>{
    router.push({path:'/about'})
}
const pushName = ()=>{
  router.push({name:'about'})
}
const pushNameParams = ()=>{
  router.push({name:'about',state:{params:{name:'tom'}}})
}
const pushPathQuery = ()=>{
  router.push({path:'/about',query:{name:'tom'}})
}
</script>
